﻿using System;
using CxRomos.Core.Domain.Entities;
using CxRomos.Web.Account.Interface;
using CxRomos.Web.Account.Presenter;

namespace CxRomos.Web.Account {
    public partial class Register : System.Web.UI.Page, IRegister {
        private RegisterPresenter _presenter;
        protected void Page_Load(object sender, EventArgs e) {
            _presenter = new RegisterPresenter();
            _presenter.Init(this);
        }

        protected void btnRegister_Click(object sender, EventArgs e) {
            var firstName = txtFirstName.Text;
            var lastName = txtLastName.Text;
            var email = txtEmail.Text;
            var password = txtPassword.Text;

            _presenter.Register(firstName, lastName, email, password);
        }

        protected void lbLogin_Click(object sender, EventArgs e) {
            _presenter.LoginLinkClicked();
        }

        public void ShowErrorMessage(string message) {
            lblErrorMessage.Text = message;
        }

        public void ShowAccountCreatedPanel() {
            pnlAccountCreated.Visible = true;
            pnlCreateAccount.Visible = false;
        }

        public void ShowCreateAccountPanel() {
            pnlAccountCreated.Visible = false;
            pnlCreateAccount.Visible = true;
        }

        public void ToggleWizardIndex(int index) {
            throw new NotImplementedException();
        }

        public void LoadTerms(Term term) {
            if(term != null) {
                
            }
        }
    }
}
